Skip to content

Conversation

xyzzyz
Copy link

@xyzzyz xyzzyz commented Oct 2, 2025

This changes allows you to select which algorithms are supported using Cargo features. By default, the newly added features are all selected, so there should be no functional/API changes.

The motivating factor was that I wanted to use rustls-webpki crate for X.509 Certificate Path Validation algorithm in a context other than TLS. For that, I don't need any of the AES/ChaCha20 etc support, and I don't want to pull these libraries into my SBOM.

In addition, to support the above, the change also exposes SignatureVerificationAlgorithms from verify::{rsa,ecdsa,eddsa} modules through public API.

One change I made was to remove SignatureScheme::ECDSA_NISTP521_SHA512 from TLS12_ECDSA_SCHEMES list: this is not actually supported by this provider, and correct me if I'm wrong, but I think it got there by mistake.

Two questions:

  • Should I squash, or do you squash on PR merge?
  • When some features are not selected (e.g. when no symmetric cipher is selected, so that the library can only be used for signature verification, or when no key exchange algorithms are selected), the compiler generates some "unused import" warnings. There is a number of ways of dealing with these: 1) ignoring them 2) silencing them on a module level, 3) using fully qualified names as needed, and 4) adding extra #[cfg(...)] to remove them. I currently went with 1), because 2) is bad, 3) makes the code unreadable because almost all of the symbols need to be qualified, and 4) requires a lot of extra cfg flags. Please let me know if you'd like me to implement 3 or 4.

@pinkforest
Copy link
Contributor

This crate is made and solely intended for TLS context only through rustls.

These ciphesuites are mandatory to implement and making them opt-in is not gonna work and goes against the intended use.

@xyzzyz
Copy link
Author

xyzzyz commented Oct 7, 2025

OK, so if someone wants to use RustCrypto primitives as providers for the rustls-webpki crate for X.509 certificate path validation in a context completely and wholly unrelated to TLS (for example, S/MIME, Authenticode or UEFI Secure Boot), what is one to do?

The obvious thing would be to simply create a new crate, and copy-paste the implementations from here. Is that what you'd recommend?

@tarcieri
Copy link
Member

tarcieri commented Oct 7, 2025

I think you two are talking past each other.

MTI algorithms shouldn’t be made optional. Others can be.

@xyzzyz
Copy link
Author

xyzzyz commented Oct 8, 2025

OK, so if we make ED25519, X25519, P-384, and RSA support optional (as they're not required by TLS 1.3), and keep just AES, SHA-2, and P-256 as required, would that be acceptable?

@xyzzyz
Copy link
Author

xyzzyz commented Oct 8, 2025

(and RSA as required, I forgot that TLS 1.3 requires it as well)

@xyzzyz
Copy link
Author

xyzzyz commented Oct 8, 2025

Alternatively, what if you simply hide TLS support itself behind a (default) feature? Basically, if you enable tls feature, you get what the crate currently does (with optional support for curve 25519 based features), but if you disable it, all you get is a bunch of SignatureVerificationAlgorithm providers that you can use with rustls-webpki?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants